/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package op.contasresumidas;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import op.QuebraStringOI;

/**
 *
 * @author Jônatas
 */
public abstract class GetResumo {

    protected String[] lines;

    protected GetResumo(String[] lines) {
        this.lines = lines;
    }

    public abstract List<ContaResumida> getContaResumida();

    protected double getValor (String linha) {
        Pattern pattern = Pattern.compile("-?([0-9][.])*[0-9]+[,][0-9]{2}");
        Matcher match = pattern.matcher(linha);

        String temp = null;

        while(match.find()) {
            temp = match.group();
        }

        if(temp == null) {
            return 0.0;
        }

        String value = temp.replace(".", "");

        return Double.parseDouble(value.replace(",", "."));

    }

}